home *** CD-ROM | disk | FTP | other *** search
- package javax.swing.filechooser;
-
- import java.io.File;
- import java.io.IOException;
- import java.lang.reflect.Method;
-
- class UnixFileSystemView extends FileSystemView {
- private static final Object[] noArgs = new Object[0];
- private static final Class[] noArgTypes = new Class[0];
- private static Method listRootsMethod = null;
- private static boolean listRootsMethodChecked = false;
- // $FF: synthetic field
- static Class class$java$io$File;
-
- // $FF: synthetic method
- static Class class$(String var0) {
- try {
- return Class.forName(var0);
- } catch (ClassNotFoundException var2) {
- throw new NoClassDefFoundError(((Throwable)var2).getMessage());
- }
- }
-
- public File createNewFolder(File var1) throws IOException {
- if (var1 == null) {
- throw new IOException("Containing directory is null:");
- } else {
- Object var2 = null;
- File var4 = ((FileSystemView)this).createFileObject(var1, "NewFolder");
-
- for(int var3 = 1; var4.exists() && var3 < 100; ++var3) {
- var4 = ((FileSystemView)this).createFileObject(var1, "NewFolder." + var3);
- }
-
- if (var4.exists()) {
- throw new IOException("Directory already exists:" + var4.getAbsolutePath());
- } else {
- var4.mkdirs();
- return var4;
- }
- }
- }
-
- public File[] getRoots() {
- if (!listRootsMethodChecked) {
- try {
- listRootsMethod = (class$java$io$File != null ? class$java$io$File : (class$java$io$File = class$("java.io.File"))).getMethod("listRoots", noArgTypes);
- } catch (NoSuchMethodException var6) {
- } finally {
- listRootsMethodChecked = true;
- }
- }
-
- if (listRootsMethod != null) {
- try {
- File[] var1 = (File[])listRootsMethod.invoke((Object)null, noArgs);
-
- for(int var2 = 0; var2 < var1.length; ++var2) {
- var1[var2] = new FileSystemRoot(var1[var2]);
- }
-
- return var1;
- } catch (Exception var8) {
- ((Throwable)var8).printStackTrace();
- }
- } else {
- File[] var9 = new File[]{new File("/")};
- if (var9[0].exists() && var9[0].isDirectory()) {
- return var9;
- }
- }
-
- return null;
- }
-
- public boolean isHiddenFile(File var1) {
- if (var1 != null) {
- String var2 = var1.getName();
- return var2.charAt(0) == '.';
- } else {
- return false;
- }
- }
-
- public boolean isRoot(File var1) {
- String var2 = var1.getAbsolutePath();
- return var2.length() == 1 && var2.charAt(0) == '/';
- }
- }
-